<script lang="ts" setup>
import { onMounted, ref } from 'vue';
/* 
怎么查找到事件的类型，或者dom
都是通过 document.addEventListener('事件名',()=>{}),利用代码提示，找到对应的事件类型，复制即可
document.querySelector('标签名')
*/
const mouse = ref({
    x: 0, y: 0
})
const move = (e: MouseEvent) => {
    mouse.value.x = e.pageX
    mouse.value.y = e.pageY
}
onMounted(
    () => {
        document.addEventListener('mousemove', move)
    }
)

const keydown = (e: KeyboardEvent) => {
    console.log('e -----> ', e.key);
}
</script>

<template>
    <div>我是vue3-ts - {{mouse}}</div>
    <button @click="move">无聊的点我</button>

    <input @keydown="keydown" />
</template>